package org.example.aienglishapp_login.dto.login;

import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

public class PermissionsWithRolesDTO {

    @Setter
    private Long permissionId;
    @Setter
    private String permissionName;
    private Set<Long> roleIds = new HashSet<>();
    private Set<String> roleNames = new HashSet<>();

    // 默认构造方法
    public PermissionsWithRolesDTO() {
    }

    // 带参数的构造方法
    public PermissionsWithRolesDTO(Long permissionId, String permissionName) {
        this.permissionId = permissionId;
        this.permissionName = permissionName;
    }

    // Getters and Setters
    public Long getPermissionId() {
        return permissionId;
    }

    public String getPermissionName() {
        return permissionName;
    }

    public Set<Long> getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(Set<Long> roleIds) {
        if (roleIds != null) {
            this.roleIds.clear();
            this.roleIds.addAll(roleIds);
        }
    }

    public Set<String> getRoleNames() {
        return roleNames;
    }

    public void setRoleNames(Set<String> roleNames) {
        if (roleNames != null) {
            this.roleNames.clear();
            this.roleNames.addAll(roleNames);
        }
    }

    @Override
    public String toString() {
        return "PermissionsWithRolesDTO{" +
                "permissionId=" + permissionId +
                ", permissionName='" + permissionName + '\'' +
                ", roleIds=" + roleIds +
                ", roleNames=" + roleNames +
                '}';
    }
}
